using AForge.Video;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
namespace SilverSea.Video.Tools
{
	public class VideoFileSettingPage : UserControl, IVideoSourcePage
	{
		private IContainer icontainer_0;
		private Label label1;
		private Button btnBrowse;
		private TextBox txtVideoFile;
		private ComboBox cbxVideoDecoder;
		private Label label5;
		private EventHandler eventHandler_0;
		private bool bool_0;
		private string string_0 = string.Empty;
		private string string_1 = string.Empty;
		private int int_0 = 1;
		private int int_1;
		private int int_2 = 1;
		private string string_2 = "640x480";
		private string string_3 = "Standard";
		private int int_3 = 30;
		private bool bool_1;
		private string string_4 = "Deinterlace Filter";
		public event EventHandler StateChanged
		{
			add
			{
				EventHandler eventHandler = this.eventHandler_0;
				EventHandler eventHandler2;
				do
				{
					eventHandler2 = eventHandler;
					EventHandler value2 = (EventHandler)Delegate.Combine(eventHandler2, value);
					eventHandler = Interlocked.CompareExchange<EventHandler>(ref this.eventHandler_0, value2, eventHandler2);
				}
				while (eventHandler != eventHandler2);
			}
			remove
			{
				EventHandler eventHandler = this.eventHandler_0;
				EventHandler eventHandler2;
				do
				{
					eventHandler2 = eventHandler;
					EventHandler value2 = (EventHandler)Delegate.Remove(eventHandler2, value);
					eventHandler = Interlocked.CompareExchange<EventHandler>(ref this.eventHandler_0, value2, eventHandler2);
				}
				while (eventHandler != eventHandler2);
			}
		}
		public bool Completed
		{
			get
			{
				return this.bool_0;
			}
		}
		public string VideoSource
		{
			get
			{
				return this.txtVideoFile.Text;
			}
			set
			{
				this.txtVideoFile.Text = value;
				this.bool_0 = (this.txtVideoFile.Text != string.Empty);
			}
		}
		public string Login
		{
			get
			{
				return this.string_0;
			}
			set
			{
				this.string_0 = value;
			}
		}
		public string Password
		{
			get
			{
				return this.string_1;
			}
			set
			{
				this.string_1 = value;
			}
		}
		public int StreamType
		{
			get
			{
				return this.int_0;
			}
			set
			{
				this.int_0 = value;
			}
		}
		public int ProtocolType
		{
			get
			{
				return this.int_1;
			}
			set
			{
				this.int_1 = value;
			}
		}
		public int Chanel
		{
			get
			{
				return this.int_2;
			}
			set
			{
				this.int_2 = value;
			}
		}
		public string Resolution
		{
			get
			{
				return this.string_2;
			}
			set
			{
				this.string_2 = value;
			}
		}
		public string Quality
		{
			get
			{
				return this.string_3;
			}
			set
			{
				this.string_3 = value;
			}
		}
		public int FrameRate
		{
			get
			{
				return this.int_3;
			}
			set
			{
				this.int_3 = value;
			}
		}
		public bool UsingDeinterlaceFilter
		{
			get
			{
				return this.bool_1;
			}
			set
			{
				this.bool_1 = value;
			}
		}
		public string DeinterlaceFilterName
		{
			get
			{
				return this.string_4;
			}
			set
			{
				this.string_4 = value;
			}
		}
		public int UsingPlugins
		{
			get
			{
				return this.cbxVideoDecoder.SelectedIndex;
			}
			set
			{
				if (value <= 1)
				{
					this.cbxVideoDecoder.SelectedIndex = value;
					return;
				}
				this.cbxVideoDecoder.SelectedIndex = 0;
			}
		}
		public VideoFileSettingPage()
		{
			this.InitializeComponent();
			this.bool_0 = (this.txtVideoFile.Text != string.Empty);
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.label1 = new Label();
			this.btnBrowse = new Button();
			this.txtVideoFile = new TextBox();
			this.cbxVideoDecoder = new ComboBox();
			this.label5 = new Label();
			base.SuspendLayout();
			this.label1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(10, 20);
			this.label1.Margin = new Padding(4, 0, 4, 0);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(66, 16);
			this.label1.TabIndex = 4;
			this.label1.Text = "Video File";
			this.btnBrowse.Location = new System.Drawing.Point(86, 14);
			this.btnBrowse.Name = "btnBrowse";
			this.btnBrowse.Size = new System.Drawing.Size(75, 28);
			this.btnBrowse.TabIndex = 5;
			this.btnBrowse.Text = "Mở ...";
			this.btnBrowse.UseVisualStyleBackColor = true;
			this.btnBrowse.Click += new EventHandler(this.btnBrowse_Click);
			this.txtVideoFile.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtVideoFile.Location = new System.Drawing.Point(13, 48);
			this.txtVideoFile.Multiline = true;
			this.txtVideoFile.Name = "txtVideoFile";
			this.txtVideoFile.Size = new System.Drawing.Size(377, 60);
			this.txtVideoFile.TabIndex = 6;
			this.txtVideoFile.TextChanged += new EventHandler(this.txtVideoFile_TextChanged);
			this.cbxVideoDecoder.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.cbxVideoDecoder.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbxVideoDecoder.FormattingEnabled = true;
			this.cbxVideoDecoder.Items.AddRange(new object[]
			{
				"DirectShow",
				"VLC"
			});
			this.cbxVideoDecoder.Location = new System.Drawing.Point(161, 119);
			this.cbxVideoDecoder.Name = "cbxVideoDecoder";
			this.cbxVideoDecoder.Size = new System.Drawing.Size(229, 24);
			this.cbxVideoDecoder.TabIndex = 16;
			this.label5.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.label5.AutoSize = true;
			this.label5.Location = new System.Drawing.Point(10, 122);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(93, 16);
			this.label5.TabIndex = 15;
			this.label5.Text = "Video Decoder";
			base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 16f);
//			base.AutoScaleMode = AutoScaleMode.Font;
			base.Controls.Add(this.cbxVideoDecoder);
			base.Controls.Add(this.label5);
			base.Controls.Add(this.txtVideoFile);
			base.Controls.Add(this.btnBrowse);
			base.Controls.Add(this.label1);
			this.Font = new System.Drawing.Font("Arial", 9.75f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
			base.Margin = new Padding(4);
			base.Name = "VideoFileSettingPage";
			base.Size = new System.Drawing.Size(403, 255);
			base.ResumeLayout(false);
			base.PerformLayout();
		}
		public void Display()
		{
			this.txtVideoFile.Focus();
		}
		public bool Apply()
		{
			return true;
		}
		private void btnBrowse_Click(object sender, EventArgs e)
		{
			OpenFileDialog openFileDialog = new OpenFileDialog();
			openFileDialog.Filter = "AVI files (*.avi)|*.avi|All files (*.*)|*.*";
			if (openFileDialog.ShowDialog() == DialogResult.OK)
			{
				this.txtVideoFile.Text = openFileDialog.FileName;
				this.bool_0 = (this.txtVideoFile.Text != string.Empty);
			}
		}
		private void txtVideoFile_TextChanged(object sender, EventArgs e)
		{
			this.bool_0 = (this.txtVideoFile.Text != string.Empty);
			if (this.eventHandler_0 != null)
			{
				this.eventHandler_0(this, new EventArgs());
			}
		}
	}
}
